package net.starwifi.duobao.service.impl;


import net.starwifi.duobao.entity.Setting;
import net.starwifi.duobao.repository.SettingRepository;
import net.starwifi.duobao.service.BaseServiceImpl;
import net.starwifi.duobao.service.SettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class SettingServiceImpl extends BaseServiceImpl<Setting,Long> implements SettingService {


    @Autowired
    SettingRepository settingRepository;

    /**
     * 修改
     * */
    @Override
    @Transactional
    @CacheEvict(value = "setting", allEntries = true)
    public void updateEntity(Setting entity, Long aLong) {
        super.updateEntity(entity, aLong);
    }


    @Override
    @Transactional
    @CacheEvict(value = "setting", allEntries = true)
    public Setting update(Setting entity) {
        return super.update(entity);
    }

    @Override
    @Transactional(readOnly = true)
    @Cacheable("setting")
    public Setting findByCode(String code) {
        return settingRepository.findByCode(code);
    }


    @Override
    @Transactional
    @CacheEvict(value = "setting", allEntries = true)
    public void clearCache() {}


}
